//
//  SecondViewController.m
//  wifi4.2
//
//  Created by 郭四虎 on 15/11/11.
//  Copyright © 2015年 YouKu. All rights reserved.
//

#import "SecondViewController.h"
#import "MyTabBarController.h"

@interface SecondViewController ()<UIGestureRecognizerDelegate>


@end

@implementation SecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBarHidden = NO;
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.tabBarController.tabBar.hidden = YES;
//    self.view.backgroundColor = [UIColor colorWithRed:229/255.0 green:229/255.0 blue:229/255.0 alpha:1];
    
    [self createNavigationLeft];


    
//    __weak typeof(self) weakSelf = self;
//    self.navigationController.interactivePopGestureRecognizer.delegate = weakSelf;
//    
//    self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    
    UISwipeGestureRecognizer *swipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(pop)];
    swipe.direction = UISwipeGestureRecognizerDirectionRight;
    [self.view addGestureRecognizer:swipe];
}


- (void)pop
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)alert:(NSString *)msg
{
    UIAlertView *alert = [[UIAlertView alloc]initWithTitle:msg message:@"" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    [alert show];
}

- (void)createNavigationLeft
{
    //icon5_meitu_2
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"8"] style:UIBarButtonItemStylePlain target:self action:@selector(backFront)];

    self.navigationItem.leftBarButtonItem = leftItem;
}

- (void)backFront
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
    self.tabBarController.tabBar.hidden = YES;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
